<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="org.apache.struts2.ServletActionContext" %>
<%@ page import="com.yyq.adms.usermanage.pojo.*" %>
<%@ page import="com.yyq.adms.sysmanage.pojo.*" %>
<%@ page import="java.util.*" %>
<%@ include file="../public/public.jsp" %>

<%
	int rowColor = 1;  
	Map map = (Map)valueStack.findValue("formMap");
	List rpms = (List) map.get("rpms");
	List modules = (List) map.get("modules");
	List mps = (List) map.get("mps");
%>

<form action="rpm.action" method="post" id="frm">

<input type="hidden" name="cmd" value="add">
<input type="hidden" id="roleId" name="po.roleId" value="<s:property value='po.roleId'/>">
<input type="hidden" id="moduleId" name="po.moduleId" value="<s:property value='po.moduleId'/>">

<table border="0" cellspacing="0" cellpadding="5" width="100%">
	
	<%
		for (int i = 0; i < modules.size(); i++) {//模块数量
			SysModules mods = (SysModules) modules.get(i);
			if ((rowColor++ % 2) == 0) {
	%>
		<tr  bgcolor="#FFFFCC">
	<%
			} else {
	%>
		<tr bgcolor="#FFFFFF">
	<%} %>
			<td width="25%">
				<font size="2"><%=mods.getModuleCname() %></font>
				<input type="hidden" name="subModule,<%=mods.getId().longValue() %>">
			</td>
			<td width="75%">
				
				<%
					for (int j = 0; mps != null&&j < mps.size(); j++) {//每个模块所拥有的操作集合
						SysModulePerms perm = (SysModulePerms) mps.get(j);
						if(mods.getId().intValue()==perm.getModuleId().intValue()){
							if(rpms.size()>0){
								boolean bool = false;
								for(int k=0; k <rpms.size(); ++k){
									SysRPM rpm = (SysRPM)rpms.get(k);
									if(rpm.getPermId().intValue()==perm.getPermId().intValue() && rpm.getModuleId().intValue()==perm.getModuleId().intValue()){
										bool = true;break;
									}
								}
								if(bool){%>
									<input type="checkbox"  name="formMap.rpms" value="<%=perm.getModuleId() %>_<%=perm.getPermId() %>" checked><font size="2"><%=perm.getPermCname() %></font>
								<%}else{%>
									<input type="checkbox"  name="formMap.rpms" value="<%=perm.getModuleId() %>_<%=perm.getPermId() %>"><font size="2"><%=perm.getPermCname() %></font>
								<%}
							}else{%>
									<input type="checkbox"  name="formMap.rpms" value="<%=perm.getModuleId() %>_<%=perm.getPermId() %>"><font size="2"><%=perm.getPermCname() %></font>
							<%}
						}
					}
				%>
				
			</td>
			<td>
				<%--  <input type="checkbox" onclick="selCheckbox(this, '<%=mods.getId().longValue() %>')">--%>
			</td>
		</tr>
	<%} %>
	<tr  bgcolor="#FFFFFF" >
		<td colspan="3" align="center"><input id="btn" type="button" value="提&nbsp;交" onclick="addRPM()"></td>
	</tr>
</table>
</form>
